// 快速数论变换 NTT 算法
// 测试链接 ：https://www.luogu.com.cn/problem/P3803
// 相关帖子 ：https://www.cnblogs.com/dx123/p/17020865.html
// 相关帖子 ：https://en.oi-wiki.org/math/poly/ntt/
// 提交以下的code，可以直接通过

#include <bits/stdc++.h>

using namespace std;

#define ll long long
const int MAXN = 4e6;
const int g = 3, P = 998244353;
int n, m, gi, ni, R[MAXN];
ll A[MAXN], B[MAXN];

ll quickPow(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1) ans = ans * a % P;
        a = a * a % P;
        b >>= 1;
    }
    return ans;
}

void NTT(ll A[], int n, int op)
{
    for(int i = 0; i < n; ++i)
    {
        R[i] = R[i / 2] / 2 + ((i & 1) ? n / 2 : 0);
    }
    for(int i = 0; i < n; ++i)
    {
        if(i < R[i]) swap(A[i], A[R[i]]);
    }
    for(int m = 2; m <= n; m <<= 1)
    {
        ll g1 = quickPow(op == 1 ? g : gi, (P - 1) / m);
        for(int i = 0; i < n; i += m)
        {
            ll gk = 1;
            for(int j = 0; j < m / 2; ++j)
            {
                ll x = A[i + j], y = A[i + j + m / 2] * gk % P;
                A[i + j] = (x + y) % P; A[i + j + m / 2] = (x - y + P) % P;
                gk = gk * g1 % P;
            }
        }
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    for(int i = 0; i <= n; ++i) scanf("%lld", &A[i]);
    for(int i = 0; i <= m; ++i) scanf("%lld", &B[i]);
    for(m = n + m, n = 1; n <= m; n <<= 1);
    gi = quickPow(g, P - 2); ni = quickPow(n, P - 2);
    NTT(A, n, 1); NTT(B, n, 1);
    for(int i = 0; i < n; ++i) A[i] = A[i] * B[i];
    NTT(A, n, -1);
    for(int i = 0; i <= m; ++i) printf("%lld ", A[i] * ni % P);

    return 0;
}